<template>
  <basic-container>
    <el-form ref="form" :model="form" label-width="110px">
      <el-row type="flex" class="row-bg" justify="end">
        <el-form-item>
          <el-button @click="handleCancel">关闭</el-button>
        </el-form-item>
      </el-row>
     <el-card shadow="hover">
        <div slot="header">
          <span>矛盾信息</span>
        </div>
        <el-row>
          <el-col :span="8">
            <el-form-item label="所属网格">
              <el-input :disabled="true" v-model="form.gridId"/>
            </el-form-item>
          </el-col>
         <el-col :span="8">
            <el-form-item label="上报人">
              <el-input :disabled="true" v-model="form.flow.assigneeName"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="事件名称">
              <el-input :disabled="true" v-model="form.eventName"/>
            </el-form-item>
          </el-col>
           <el-col :span="8">
            <el-form-item label="发生日期">
              <el-input :disabled="true" v-model="form.happenDate"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="发生地点">
              <el-input :disabled="true" v-model="form.happenPlace"/>
            </el-form-item>
          </el-col>
           <el-col :span="8">
            <el-form-item label="事件规模">
              <el-input :disabled="true" v-model="form.eventScale"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="事件类别">
              <el-input :disabled="true" v-model="form.eventCategory"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="涉及人数">
              <el-input :disabled="true" v-model="form.numberInvolved"/>
            </el-form-item>
          </el-col>
          
           <el-col :span="8">
            <el-form-item label="涉及单位">
              <el-input :disabled="true" v-model="form.relatedUnits"/>
            </el-form-item>
          </el-col>
           <el-col :span="24">
            <el-form-item label="事件描述">
              <el-input :disabled="true" type="textarea" v-model="form.eventDescription"/>
            </el-form-item>
          </el-col>
           <el-col :span="8">
            <el-form-item label="主要当事人姓名">
              <el-input :disabled="true" v-model="form.name"/>
            </el-form-item>
          </el-col>
           <el-col :span="8">
            <el-form-item label="当事人证件">
              <el-input :disabled="true" v-model="form.identificationCode"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="当事人证件号码">
              <el-input :disabled="true" v-model="form.idCard"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="当事人性别">
              <el-input :disabled="true" v-model="form.sex"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="当事人民族">
              <el-input :disabled="true" v-model="form.nation"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="当事人学历">
              <el-input :disabled="true" v-model="form.education"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="当事人类别">
              <el-input :disabled="true" v-model="form.personnelCategory"/>
            </el-form-item>
          </el-col>
           <el-col :span="16">
            <el-form-item label="当事人居住详址">
              <el-input :disabled="true" v-model="form.detailAddress"/>
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>
      <el-card shadow="hover">
        <div slot="header">
          <span>流程信息</span>
        </div>
        <el-row type="flex" class="row-bg">
          <el-timeline>
            <el-timeline-item :key="flow.id" :timestamp="flow.createTime" v-for="flow in flowList" placement="top">
              <el-card shadow="hover">
                <p>{{flow.assigneeName}} 在 [{{flow.createTime}}] 开始处理 [{{flow.historyActivityName}}] 环节</p>
                <p v-if="flow.historyActivityDurationTime!==''">任务历时 [{{flow.historyActivityDurationTime}}]</p>
                <p v-if="flow.comment!==''">批复意见: [{{flow.comment}}]</p>
                <p v-if="flow.endTime!==''">结束时间: [{{flow.endTime}}]</p>
              </el-card>
            </el-timeline-item>
          </el-timeline>
        </el-row>
      </el-card>
      <el-card shadow="hover">
        <div slot="header">
          <span>流程跟踪</span>
        </div>
        <el-row type="flex" class="row-bg">
          <img :src="src" alt="design">
        </el-row>
      </el-card>
    </el-form>
  </basic-container>
</template>

<script>
  import {historyFlowList, disputeDetail} from "@/api/work/process";

  export default {
    data() {
      return {
        businessId: '',
        processInstanceId: '',
        src: '',
        flowList: [],
        form: {
          flow: {
            assigneeName: '',
          },
          gridId: '',
          eventName: '',
          happenDate: '',
          happenPlace: '',
          eventScale: '',
          eventCategory: '',
          numberInvolved: '',
          eventDescription: '',
          relatedUnits: '',
          identificationCode: '',
          idCard: '',
          sex: '',
          nation: '',
          education: '',
          personnelCategory: '',
          detailAddress: '',
          
        }
      }
    },
    created() {
      this.init();
    },
    methods: {
      prev(){
          this.$router.go(-1)
      },
      init() {
        this.processInstanceId = this.$route.params.processInstanceId;
        this.businessId = this.$route.params.businessId;
        this.src = `/api/smart-flow/process/diagram-view?processInstanceId=${this.$route.params.processInstanceId}`;
        historyFlowList(this.processInstanceId).then(res => {
          const data = res.data;
          if (data.success) {
            this.flowList = data.data;
          }
        })
        disputeDetail(this.businessId).then(res => {
          const data = res.data;
          if (data.success) {
            this.form = data.data;
          }
        })
      },
      handleCancel() {
        this.$router.$avueRouter.closeTag();
        //this.$router.push({path: `/work/start`});
        this.prev();
        //this.$router.push({path: `/ninebasic/dispute/todo`});
      }
    }
  }
</script>
